<!DOCTYPE html>
<html>
  <head>
    <title>更新用户</title>
	
    <meta name="keywords" content="keyword1,keyword2,keyword3">
    <meta name="description" content="this is my page">
    <meta name="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->

  </head>
  
  <body>
    姓名：<input type="text" id="name" value="${user.name}"><br/>
    性别：<input type="text" id="sex" value="${user.sex}"><br/>
    住址：<input type="text" id="address" value="${user.address}"><br/>
    联系电话：<input type="text" id="phone" value="${user.phone}"><br/>
    电子邮件：<input type="text" id="email" value="${user.email}"><br/>
	<button type="button" onclick="update()">确定</button>
	<button type="button" ><a href="${path}/index/index">返回</button>
  
  
  <script type="text/javascript" src="${path}/js/jquery.min.js"></script>
  
  <script>
   function update(){
            var name =	document.getElementById("name").value;
            var sex =	document.getElementById("sex").value;
            var address =	document.getElementById("address").value;
            var phone =	document.getElementById("phone").value;
            var email =	document.getElementById("email").value;
            alert(email);
            $.ajax({
          	  		type:"post",
                    url:'${path}/user/update',
                    datatype:"json",
                    data:{
                    		id:${user.id},
                            name:name,
                            sex:sex,
                            address:address,
                            phone:phone,
                            email:email,
                    },
                   success:function(data){
                   alert("注册信息不符合标准。");
                  	 alert(data);
           			 },error:function(data){
    				 alert("修改成功。");
    				 window.location.href="${path}/index/index";
           			 
           			 }
            });
                    }
  </script>
  </body>
</html>
